type multiViewType = 'sag' | 'cor' | 'ax'

type singleViewType = 'stack'

type allViewType = multiViewType | singleViewType | 'mpr' | 'volume'

type mprViewPositionType = 'left1' | 'left2' | 'right'


type windowGroupType = 'mpr' | 'stack'

enum EnumAllViewType {
  stack = 'stack',
  sag = 'sag',
  cor = 'cor',
  ax = 'ax',
  mpr = 'mpr',
  volume = 'volume',
  performance = 'performance',
}

enum EnumOpTypes {
  getImg = 'getImg',
  setSize = 'setSize'
}

enum EnumImgOpType {
  window = 'window',
  pan = 'pan',
  zoom = 'zoom',
  cross = 'cross',
  scroll = 'scroll',
  measure = 'measure',
  rotate3D = 'rotate3D',
  performance = 'performance',
}

enum EnumUserActionType {
  down = 'down',
  move = 'move',
  up = 'up',
  none = 'none',
  drag = 'drag',
  click = 'click',
}

interface opMsgType {
  viewType: allViewType
  opType: string,
  subOpType?: string,
  actionType?: EnumUserActionType,

  x?: number
  y?: number
  zoom?: number,
  scroll?: number,
  interval?: number,
  hor_flip?: boolean,
  ver_flip?: boolean,
}

interface mprImgProvideType {
  sag: string
  cor: string
  ax: string
}

interface mprImgProvideCenterType {
  sag: number[]
  cor: number[]
  ax: number[]
}


interface aspectType {
  width: number
  height: number
}

type mprAspectType = {
  [key in multiViewType]?: aspectType
}

type singleViewAspectType = aspectType

type loadImgType = loadSingleViewType | loadImgMprType | resizeViewType

interface loadSingleViewType {
  viewType: allViewType
  opType: EnumOpTypes
  address?: string
  size?: singleViewAspectType,
}

interface loadImgMprType {
  viewType: allViewType
  opType: 'getImg'
  address?: string
  size?: mprAspectType
}


interface resizeViewType {
  viewType: allViewType,
  opType: 'resize',
  size?: singleViewAspectType | mprAspectType
}

interface GatewayMsgType {
  systemType: string,

  [key: string]: any;
}


interface resetViewType {
  viewType: allViewType,
  opType?: 'reset'
}

interface windowArrType {
  viewType: allViewType
  imgSrc: string
  ref: string
  position: mprViewPositionType
}

interface msgReceivedType {
  viewType: allViewType
  imgs: mprImgProvideType | string
  center?: any
}

type opType = {
  type: string,
  subType: string,
}

export type {
  allViewType,
  opMsgType,
  loadImgType,
  aspectType,
  mprImgProvideType,
  windowArrType,
  loadImgMprType,
  mprAspectType,
  msgReceivedType,
  mprImgProvideCenterType,
  resetViewType,
  multiViewType,
  loadSingleViewType,
  resizeViewType,
  GatewayMsgType,
  windowGroupType,
  opType
}

export {
  EnumUserActionType,
  EnumAllViewType,
  EnumImgOpType,
  EnumOpTypes
}

